package main1.a_FactoryMethodModel;

/**
 * Created by newtranx_011 on 2017/9/13.
 *
 */
public class Main {

    public static void main(String[] args) {
//        ptFactory();
//        ptFactory1();
        ptFactory2();
    }

    /**
     * 普通工厂模式
     */
    public static void ptFactory() {
        SendFactory factory = new SendFactory();
        Sender sender = factory.produce("sms");
        sender.Send();

        Sender sender1 = factory.produce("mail");
        sender1.Send();
    }
    /**
     * 多工厂模式
     */
    public static void ptFactory1() {
        SendFactory1 factory = new SendFactory1();
        Sender sender = factory.produceMail();
        sender.Send();

        Sender sender1 = factory.produceSms();
        sender1.Send();
    }

    /**
     * 静态工厂方法模式
     */
    public static void ptFactory2() {
        Sender sender = SendFactory2.produceMail();
        sender.Send();

        Sender sender1 = SendFactory2.produceSms();
        sender1.Send();
    }
}
